Skip to content

docs: refresh stale architecture and structure docs#4580

Open
pinebit wants to merge 2 commits into
mainfrom
refresh-architecture-doc
Open

docs: refresh stale architecture and structure docs#4580
pinebit wants to merge 2 commits into
mainfrom
refresh-architecture-doc

Conversation

@pinebit

@pinebit pinebit commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Updates docs/architecture.md, docs/structure.md and the CLAUDE.md architecture summary to match the current implementation.

docs/architecture.md:

  • Keeps both ASCII diagrams; removes the Signer/remote-signer component from the workflow diagram (it does not exist in the code) and corrects the BFT fault tolerance note to t = ceil(2n/3) available and honest nodes, tolerating f = floor((n-1)/3) faulty nodes.
  • Updates all interface snippets to match core/interfaces.go (Scheduler, Fetcher, Consensus + ConsensusController, DutyDB, ValidatorAPI, ParSigDB, SigAgg, AggSigDB, Broadcaster) and notes that file as the source of truth.
  • Scheduler: bulk cached validator resolution, sync committee and derived aggregator/sync-contribution duty scheduling, slot offsets, SSE head/reorg event handling, builder registration submission.
  • Consensus: documents the pluggable consensus controller with QBFT v2.0 as default and priority-protocol-based selection, linking to docs/consensus.md.
  • DutyDB/ParSigDB/AggSigDB: replaces outdated relational data models with the actual in-memory designs, inline threshold matching and deadliner-based trimming; resolves stale TODO/open questions.
  • Validator API: replaces the outdated endpoint list with a table of currently intercepted endpoints and updates the SignedData implementations list.
  • Adds a duty lifecycle table (initiator, consensus, broadcast per duty type) and a supporting components section (Tracker, InclusionChecker, Priority/InfoSync, Deadliner, duty gater, caches, builder registration service).

docs/structure.md:

  • Removes references to deleted code (core/encode.go, app/dbindex/, p2p/discovery.go/discv5) and describes relay-based peer discovery.
  • Adds missing packages (core/consensus, core/tracker, core/priority, core/infosync, app infrastructure libraries, eth2util and testutil subpackages) and the current CLI command tree (combine, exit, deposit, feerecipient, alpha, unsafe).

CLAUDE.md:

  • Aligns the architecture summary with the refreshed docs: pluggable consensus controller, corrected Priority and peer discovery descriptions, adds the InclusionChecker.

category: docs
ticket: none

pinebit and others added 2 commits July 3, 2026 22:51
Update docs/architecture.md and docs/structure.md to match the current
implementation: fix component interfaces to match core/interfaces.go,
remove the nonexistent Signer/remote-signer component, correct the BFT
fault tolerance formula, document the consensus controller and priority
protocol, replace outdated DutyDB/ParSigDB data models, refresh the
validator API endpoint list, and add a duty lifecycle table and
supporting components section. Update the project structure doc with
current packages and CLI commands.

category: docs
ticket: none

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Mention the pluggable consensus controller, correct the Priority and
peer discovery descriptions, and add the InclusionChecker.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Jul 3, 2026

Copy link
Copy Markdown

@pinebit pinebit requested review from KaloyanTanev and OisinKyne July 3, 2026 19:53
@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.22%. Comparing base (6ffb9bb) to head (5f116ee).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4580      +/-   ##
==========================================
+ Coverage   57.20%   57.22%   +0.02%     
==========================================
  Files         245      245              
  Lines       33449    33449              
==========================================
+ Hits        19135    19142       +7     
+ Misses      11890    11880      -10     
- Partials     2424     2427       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread docs/architecture.md
Comment on lines 16 to 53
@@ -43,11 +52,11 @@
- **VC**: `n` physical validator clients (`1` per CN)
- **PS**: `nxm` physical private shares (`m` per VC, `n` per DV)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this one can be improved as well.

The CV part is being too much under focus.
The BN part can be different and it's good to be reflected in the graph.
The private key shares probably can be portrayed better, that they are in fact partials.

I can make a commit myself for that if fine by you @pinebit .

Comment thread docs/architecture.md
Comment on lines +83 to +85
*Sign* │ | | ┌──┴─┐
duty │ | └----─┤VAPI◄───────────────────│── VC
data │ | └──┬─┘ │ Query, sign, submit
| ├────────────┘
data │ | └──┬─┘ │ Query, sign, submit

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one needs to be fixed as well. VAPI also makes calls to the BN, so it needs the &

Suggested change
*Sign* │ | | ┌──┴─┐ │
duty │ | └----─┤VAPI◄───────────────────│── VC
data │ | └──┬─┘ │ │ Query, sign, submit
| ├────────────┘ │
data │ | └──┬─┘ │ Query, sign, submit
*Sign* │ | | ┌──┴─┐ │
duty │ | └----─┤VAPI◄───────────────────│── VC
data │ | └&─┬─┘ │ Query, sign, submit

Comment thread docs/architecture.md

Charon core business logic is modeled as a workflow, with a duty being performed in a slot as the “unit of work”.
```
Core Workflow

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest, this flow is so vastly different per duty, that I tend to believe it can confuse more the reader / don't give the desired info, rather than be of any help.

The table you've put below that is per duty can probably be expanded to something like this core workflow. I'm thinking of something like - having each of the components lined out beforehand and just putting them together for each duty.

I can make a commit myself for that if fine by you @pinebit .

Comment thread docs/architecture.md

- At startup, it submits registrations for all DVs in the cluster (found in cluster-lock.json).
- Thereafter, it submits registrations in the first slot of every epoch.
- Thereafter, it submits registrations in the first slot of every epoch (delayed to ~75% into the slot to reduce beacon node load).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Thereafter, it submits registrations in the first slot of every epoch (delayed to ~75% into the slot to reduce beacon node load).
- Thereafter, it submits registrations in the first slot of every epoch (delayed to ~75% into the slot to capture timeframe with less load on the beacon node).

Comment thread docs/architecture.md
Comment on lines +216 to +217
[Get attester duties](https://ethereum.github.io/beacon-APIs/#/ValidatorRequiredApi/getAttesterDuties),
[Get block proposer duties](https://ethereum.github.io/beacon-APIs/#/ValidatorRequiredApi/getProposerDuties)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to reverse those. I thought we did... Not a docs issue though.

Meaning first proposer duties and then attester duties, as that's the order of importance (based on the time in the slot they are executed). We may go to the async route of firing all 3 at once, but I'm cautious doing the 3 request at once will result in resolving proposer duties net slower.

Comment thread docs/architecture.md
Comment on lines +225 to +231
Duties are not all triggered at the start of the slot. Per the spec, duty types have different
target offsets into the slot (see [core/scheduler/offset.go](../core/scheduler/offset.go)):
- `DutyAttester`: 1/3 into the slot
- `DutyAggregator`: 2/3 into the slot
- `DutySyncContribution`: 2/3 into the slot
- Other duties (e.g. `DutyProposer`): at the start of the slot

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really specific for DVs, neither as relevant here. I'd say we can delete that. Or at least put it into other place of the architecture where it's more relevant.

Comment thread docs/architecture.md
Comment on lines +233 to +237
- *Head events* can trigger early fetching of attestation data as soon as the head block for the slot is known,
instead of waiting for the 1/3 slot offset (gated by the `fetch_att_on_block` feature flags). The early-fetched
data is cached by the fetcher via its `FetchOnly` method without triggering the rest of the workflow.
- *Chain reorg events* invalidate resolved duties (and the fetcher's early-fetched attestation data) since they
were resolved against a head that may no longer be canonical.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not keen on putting logic that is behind a feature flag in the architecture.

Comment thread docs/architecture.md

For `DutyAttester` it [fetches AttestationData](https://github.com/ethereum/beacon-APIs/blob/master/validator-flow.md#/ValidatorRequiredApi/produceAttestationData) from the beacon node.
For `DutyAttester` it [fetches AttestationData](https://github.com/ethereum/beacon-APIs/blob/master/validator-flow.md#/ValidatorRequiredApi/produceAttestationData) from the beacon node
(unless already early-fetched via `FetchOnly`, see the scheduler's SSE head event handling above).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, an unstable yet feature flag logic.

Comment thread docs/architecture.md
| `POST /eth/v1/validator/contribution_and_proofs` | `DutySyncContribution`: partial signatures stored in `ParSigDB`. |
| `POST /eth/v1/validator/prepare_beacon_proposer` | No-op, returns 200 OK (fee recipients are configured by charon from cluster-lock.json). |
| `GET /eth/v1/node/version` | Returns charon version info. |
| `GET /eth/v1/events` | Server-sent events stream. |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That gives no details. And it's important to do so.

Suggested change
| `GET /eth/v1/events` | Server-sent events stream. |
| `GET /eth/v1/events` | Wire events to the first beacon node configured in Charon. |

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants